<?php

use App\Admin\Controllers\AjaxController;
use App\Admin\Controllers\AuditExpenseController;
use App\Admin\Controllers\AuditIncomeController;
use App\Admin\Controllers\AuditWagesController;
use App\Admin\Controllers\BlacklistController;
use App\Admin\Controllers\CompanyController;
use App\Admin\Controllers\ContractedCustomerController;
use App\Admin\Controllers\CustomerController;
use App\Admin\Controllers\FinanceExpensesController;
use App\Admin\Controllers\FinanceIncomeController;
use App\Admin\Controllers\IndexController;
use App\Admin\Controllers\ReportFormsController;
use App\Admin\Controllers\StuffController;
use App\Admin\Controllers\StuffWagesController;
use App\Admin\Controllers\TaskController;
use App\Admin\Controllers\TaskOfMy1Controller;
use App\Admin\Controllers\TaskRelatedController;
use App\Admin\Controllers\TaskUserController;
use App\Admin\Controllers\TaskUserRelatedController;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;

Admin::routes();

Route::group([
    'prefix' => config('admin.route.prefix'),
    'namespace' => config('admin.route.namespace'),
    'middleware' => config('admin.route.middleware'),
    'as' => config('admin.route.prefix') . '.',
], function (Router $router) {
    $router->post('auth/login', 'AuthController@postLogin');

    Route::group(['middleware' => ['userinfo']], function () {
        Route::prefix('ajax')->group(function () {
            Route::post('customerCreate', [AjaxController::class, 'customerCreate'])->name('ajax.customerCreate');
            Route::post('customerEdit', [AjaxController::class, 'customerEdit'])->name('ajax.customerEdit');
            Route::post('customerScore', [AjaxController::class, 'customerScore'])->name('ajax.customerScore');
            Route::post('customerDelete', [AjaxController::class, 'customerDelete'])->name('ajax.customerDelete');
            Route::post('customerShare', [AjaxController::class, 'customerShare'])->name('ajax.customerShare');
            Route::post('taskCreate', [AjaxController::class, 'taskCreate'])->name('ajax.taskCreate');
            Route::post('getAllocationUser', [AjaxController::class, 'getAllocationUser'])->name('ajax.getAllocationUser');
            Route::post('blacklistCreate', [AjaxController::class, 'blacklistCreate'])->name('ajax.blacklistCreate');
            Route::post('taskAllocation', [AjaxController::class, 'taskAllocation'])->name('ajax.taskAllocation');//资源管理-分配资源
            Route::post('taskTransfer', [AjaxController::class, 'taskTransfer'])->name('ajax.taskTransfer');//资源管理-分配资源
            Route::post('taskForward', [AjaxController::class, 'taskForward'])->name('ajax.taskForward');//资源管理-转赠
            Route::post('taskImport', [AjaxController::class, 'taskImport'])->name('ajax.import');//资源管理-导入
            Route::post('taskDelete', [AjaxController::class, 'taskDelete'])->name('ajax.taskDelete');//资源管理-删除
            Route::post('taskFollowUp', [AjaxController::class, 'taskFollowUp'])->name('ajax.taskFollowUp');//资源管理-回访
            Route::post('contractedCustomerCreate', [AjaxController::class, 'contractedCustomerCreate'])->name('ajax.contractedCustomerCreate');//签约客户信息管理
            Route::post('contractedCustomerEdit', [AjaxController::class, 'contractedCustomerEdit'])->name('ajax.contractedCustomerEdit');//签约客户信息管理
            Route::post('contractedCustomerDelete', [AjaxController::class, 'contractedCustomerDelete'])->name('ajax.contractedCustomerDelete');//签约客户信息管理
            Route::post('incomeCreate', [AjaxController::class, 'incomeCreate'])->name('ajax.incomeCreate');
            Route::post('incomeDelete', [AjaxController::class, 'incomeDelete'])->name('ajax.incomeDelete');
            Route::post('incomeAudit', [AjaxController::class, 'incomeAudit'])->name('ajax.incomeAudit');
            Route::post('getContractUserAccountInfo', [AjaxController::class, 'getContractUserAccountInfo'])->name('ajax.getContractUserAccountInfo');
            Route::post('expenseCreate', [AjaxController::class, 'expenseCreate'])->name('ajax.expenseCreate');
            Route::post('expenseDelete', [AjaxController::class, 'expenseDelete'])->name('ajax.expenseDelete');
            Route::post('expenseEdit', [AjaxController::class, 'expenseEdit'])->name('ajax.expenseEdit');
            Route::post('expenseAudit', [AjaxController::class, 'expenseAudit'])->name('ajax.expenseAudit');
            Route::post('wagesCreate', [AjaxController::class, 'wagesCreate'])->name('ajax.wagesCreate');
            Route::post('wagesEdit', [AjaxController::class, 'wagesEdit'])->name('ajax.wagesEdit');
            Route::post('wagesDelete', [AjaxController::class, 'wagesDelete'])->name('ajax.wagesDelete');
            Route::post('wagesAudit', [AjaxController::class, 'wagesAudit'])->name('ajax.wagesAudit');
            Route::post('stuffReportForms', [AjaxController::class, 'stuffReportForms'])->name('ajax.stuffReportForms');
            Route::post('stuffDelete', [AjaxController::class, 'stuffDelete'])->name('ajax.stuffDelete');
            Route::post('customerFollowUp', [AjaxController::class, 'customerFollowUp'])->name('ajax.customerFollowUp');
            Route::post('stuffStatusTrans', [AjaxController::class, 'stuffStatusTrans'])->name('ajax.stuffStatusTrans');
            Route::get('getScore', [AjaxController::class, 'getScore'])->name('ajax.getScore');
            Route::post('saveScore', [AjaxController::class, 'saveScore'])->name('ajax.saveScore');
            Route::post('numberToChinese', [AjaxController::class, 'numberToChinese'])->name('ajax.numberToChinese');
        });

        Route::prefix('customer')->group(function () {
            Route::get(null, [CustomerController::class, 'index'])->name('customer.index');
        });
        Route::prefix('stuff')->group(function () {
            Route::get(null, [StuffController::class, 'index'])->name('stuff.index');
            Route::get('create', [StuffController::class, 'create'])->name('stuff.create');
            Route::post(null, [StuffController::class, 'store'])->name('stuff.store');
            Route::get('{id}/edit', [StuffController::class, 'edit'])->name('stuff.edit')->whereNumber('id');
            Route::put('{id}', [StuffController::class, 'update'])->name('stuff.update')->whereNumber('id');
        });

        Route::prefix('company')->group(function () {
            Route::get(null, [CompanyController::class, 'index'])->name('company.index');
            Route::get('create', [CompanyController::class, 'create'])->name('company.create');
            Route::post(null, [CompanyController::class, 'store'])->name('company.store');
            Route::get('{id}/edit', [CompanyController::class, 'edit'])->name('company.edit')->whereNumber('id');
            Route::put('{id}', [CompanyController::class, 'update'])->name('company.update')->whereNumber('id');
        });
        Route::prefix('memo')->group(function () {
            Route::get(null, [CustomerController::class, 'index'])->name('customer.index');
        });
        Route::prefix('task')->group(function () {
            Route::get(null, [TaskController::class, 'index'])->name('task.index');
            Route::get('{id}/edit', [TaskController::class, 'edit'])->name('task.edit')->whereNumber('id');
            Route::post(null, [TaskController::class, 'store'])->name('task.store');
            Route::get('related/{id}', [TaskRelatedController::class, 'index'])->whereNumber('id');
        });
        Route::prefix('taskUser')->group(function () {
            Route::get(null, [TaskUserController::class, 'index'])->name('taskUser.index');
            Route::get('{id}/edit', [TaskController::class, 'edit'])->name('task.edit')->whereNumber('id');
            Route::post(null, [TaskController::class, 'store'])->name('task.store');
            Route::get('related/{id}', [TaskUserRelatedController::class, 'index'])->whereNumber('id');
        });
        Route::prefix('blacklist')->group(function () {
            Route::get('', [BlacklistController::class, 'index'])->name('blacklist.index');
            Route::get('{id}/edit', [BlacklistController::class, 'edit'])->name('blacklist.edit')->whereNumber('id');
            Route::put('{id}', [BlacklistController::class, 'update'])->name('blacklist.update')->whereNumber('id');
        });
        Route::prefix('contractedCustomer')->group(function () {
            Route::get('', [ContractedCustomerController::class, 'index'])->name('ContractedCustomer.index');
        });
        Route::prefix('financeIncome')->group(function () {
            Route::get('', [FinanceIncomeController::class, 'index'])->name('financeIncome.index');
            Route::get('create', [FinanceIncomeController::class, 'create'])->name('financeIncome.create');
            Route::post(null, [FinanceIncomeController::class, 'store'])->name('financeIncome.store');
            Route::get('{id}/edit', [FinanceIncomeController::class, 'edit'])->name('financeIncome.edit')->whereNumber('id');
            Route::put('{id}', [FinanceIncomeController::class, 'update'])->name('financeIncome.update')->whereNumber('id');
        });
        Route::prefix('financeExpenses')->group(function () {
            Route::get('', [FinanceExpensesController::class, 'index'])->name('financeExpenses.index');
            Route::get('create', [FinanceExpensesController::class, 'create'])->name('financeExpenses.create');
            Route::post(null, [FinanceExpensesController::class, 'store'])->name('financeExpenses.store');
            Route::get('{id}/edit', [FinanceExpensesController::class, 'edit'])->name('financeExpenses.edit')->whereNumber('id');
            Route::put('{id}', [FinanceExpensesController::class, 'update'])->name('financeExpenses.update')->whereNumber('id');
        });
        Route::prefix('audit')->group(function () {
            Route::get('incomeAudit', [AuditIncomeController::class, 'index'])->name('audit.incomeAudit.index');
            Route::get('expenseAudit', [AuditExpenseController::class, 'index'])->name('audit.expenseAudit.index');
            Route::get('wagesAudit', [AuditWagesController::class, 'index'])->name('audit.wagesAudit.index');
        });
        Route::prefix('stuffWages')->group(function () {
            Route::get('', [StuffWagesController::class, 'index'])->name('stuffWages.index');
        });
        Route::prefix('reportForms')->group(function () {
            Route::get('stuff', [ReportFormsController::class, 'stuff'])->name('reportForms.stuff');
            Route::get('total', [ReportFormsController::class, 'total'])->name('reportForms.stuff');
        });
        Route::prefix('index')->group(function () {
            Route::get('', [IndexController::class, 'index'])->name('index');
        });
    });
    $router->get('/', 'HomeController@index')->name('home');
    $router->get('hello', 'HomeController@hello')->name('hello');
});
